#include "uni_log.h"
#include "tuya_uart.h"
#include "tal_mutex.h"
#include "tal_memory.h"
#include "tal_thread.h"
#include "tkl_init_common.h"
#include "tkl_uart.h"
#include "tuya_svc_netmgr.h"

#define MAX_DATE_LEN 32U    // 帧缓存大小
#define FRAME_HEADER_1 0x55 // 帧头1
#define FRAME_HEADER_2 0xaa // 帧头2

typedef struct {
    UINT8_T on_push;     // 开关机状态
    UINT8_T speed_power; // 速度/功率
    UINT8_T led_sta;     // led状态
    UINT8_T filed_bit;   // 错误码
    UINT8_T net_sta;     // 联网状态
    UINT8_T config_net;  // 配置网络
    UINT8_T flag_change; // 参数改变后标志
} tp_driver_t;

extern tp_driver_t tp_dev;
extern void tp_init(void);

extern UINT8_T tp_send_drv_state(UINT8_T led_sta, UINT8_T on_push, UINT8_T speed);
extern UINT8_T tp_send_drv_single(UINT8_T net_sta);
extern UINT8_T tp_send_chenge_state(void);
extern UINT8_T tp_send_mix_fields_update(UINT8_T led_sta, \ 
                                  UINT8_T on_push, \
                                  UINT8_T speed, \
                                  UINT8_T clear_err);